import React, {Component} from 'react';
import TabControl from "./TabControl/TabControl";

class App extends Component {

    constructor(props) {
        super(props);
        this.state = {
            titles: ['流行', '新款', '精选'],
            cIndex: 0
        }
    }

    tabClick(index) {
        this.setState({
            cIndex: index
        })
    }

    render() {

        const {titles, cIndex} = this.state
        return (
            <div>
                <TabControl titles={titles} tabClict={(index) => this.tabClick(index)}/>
                <h2>{titles[cIndex]}</h2>
            </div>
        )
    }
}

export default App;